package com.plm.mongo.util;

import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;

/**
 * @author Limi
 * @create 2018-12-31 17:55
 */
public class MongoUtil {

    private static String mongouri = "mongodb://localhost:27017/test";

    public static MongoClient getMongoClient(){
        MongoClientURI uri = new MongoClientURI(mongouri);
        return new MongoClient(uri);
    }

    public static void closeMongoClient(MongoClient mongoClient){
        if (mongoClient != null) {
            mongoClient.close();
        }
    }

}
